/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.model.sap;

import com.google.common.collect.Lists;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import java.io.Serializable;
import java.util.List;

/**
 * 发送给sap的交易数据
 * <p>
 * &lt;TRANSACTION&gt;
 * </p>
 * <p class="p1">
 * <span class="s1"><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;HEADER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILSTOREID&gt;<span class="s1">1842</span>&lt;/RETAILSTOREID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;BUSINESSDAYDATE&gt;<span class="s1">20180419</span>&lt;/BUSINESSDAYDATE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;TRANSTYPECODE&gt;<span class="s1">1001</span>&lt;/TRANSTYPECODE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;WORKSTATIONID&gt;<span class="s1">0788</span>&lt;/WORKSTATIONID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;TRANSNUMBER&gt;<span class="s1">184231848272</span>&lt;/TRANSNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;BEGINTIMESTAMP&gt;<span class="s1">20180419094507</span>&lt;/BEGINTIMESTAMP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;ENDTIMESTAMP&gt;<span class="s1">20180419094507</span>&lt;/ENDTIMESTAMP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;OPERATORID&gt;<span class="s1">70010860</span>&lt;/OPERATORID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;PARTNERID&gt;<span class="s1">70010860</span>&lt;/PARTNERID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/HEADER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM1&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;CUSTOMERDETAILS&gt;<span class="s1">00</span>&lt;/CUSTOMERDETAILS&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM1&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM2&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILTYPECODE&gt;<span class="s1">1003</span>&lt;/RETAILTYPECODE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;ITEMID&gt;<span class="s1">60248955</span>&lt;/ITEMID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILQUANTITY&gt;<span class="s1">1</span>&lt;/RETAILQUANTITY&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;SALESAMOUNT&gt;<span class="s1">89</span>&lt;/SALESAMOUNT&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;SERIALNUMBER&gt;<span class="s1">0</span>&lt;/SERIALNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;PROMOTIONID&gt;<span class="s1">1510000037</span>&lt;/PROMOTIONID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;ENTRYMETHODCODE/&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;ACTUALUNITPRICE&gt;<span class="s1">89</span>&lt;/ACTUALUNITPRICE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM2&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM3&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;DISCNUMBER&gt;<span class="s1">1</span>&lt;/DISCNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;DISCTYPECODE&gt;<span class="s1">ZCXS</span>&lt;/DISCTYPECODE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;REDUCTIONAMOUNT&gt;<span class="s1">0</span>&lt;/REDUCTIONAMOUNT&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;DISCID/&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;BONUSBUYID&gt;<span class="s1">0</span>&lt;/BONUSBUYID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM3&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDGROUP&gt;<span class="s1">1007</span>&lt;/FIELDGROUP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDNAME&gt;<span class="s1">RECNNR</span>&lt;/FIELDNAME&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDVALUE&gt;<span class="s1">1042579</span>&lt;/FIELDVALUE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDGROUP&gt;<span class="s1">1009</span>&lt;/FIELDGROUP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDNAME&gt;<span class="s1">ZZGHN</span>&lt;/FIELDNAME&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDVALUE&gt;<span class="s1">18420044</span>&lt;/FIELDVALUE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDGROUP&gt;<span class="s1">1012</span>&lt;/FIELDGROUP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDNAME&gt;<span class="s1">CONS_PROCG</span>&lt;/FIELDNAME&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDVALUE&gt;<span class="s1">4</span>&lt;/FIELDVALUE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDGROUP&gt;<span class="s1">2001</span>&lt;/FIELDGROUP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDNAME&gt;<span class="s1">OTRANSNUMBER</span>&lt;/FIELDNAME&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDVALUE&gt;<span class="s1">01</span>&lt;/FIELDVALUE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM4&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM6&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;RETAILNUMBER&gt;<span class="s1">1</span>&lt;/RETAILNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;LOYNUMBER&gt;<span class="s1">1</span>&lt;/LOYNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;CUSTCARDNUMBER&gt;<span class="s1">6221660041247512</span>&lt;/CUSTCARDNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;CUSTCARDTYPE&gt;<span class="s1">N</span>&lt;/CUSTCARDTYPE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM6&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM7&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDGROUP&gt;<span class="s1">1015</span>&lt;/FIELDGROUP&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDNAME&gt;<span class="s1">ZYTBJ</span>&lt;/FIELDNAME&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;FIELDVALUE&gt;<span class="s1">1</span>&lt;/FIELDVALUE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM7&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;ITEM8&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;TENDERNUMBER&gt;<span class="s1">1</span>&lt;/TENDERNUMBER&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;TENDERTYPECODE&gt;<span class="s1">27</span>&lt;/TENDERTYPECODE&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;TENDERAMOUNT&gt;<span class="s1">89</span>&lt;/TENDERAMOUNT&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;ACCOUNTNUMBER/&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; </span></span>&lt;REFERENCEID&gt;<span class="s1">0</span>&lt;/REFERENCEID&gt;<span class="s1"><br/><span class="Apple-converted-space">&nbsp; &nbsp; </span></span>&lt;/ITEM8&gt;<span class="s1"><br/></span>&lt;/TRANSACTION&gt;
 * </p>
 *
 * @author joewee
 * @version 1.0.0
 * @Date 2018/5/18 11:51
 */
@XStreamAlias("TRANSACTION")
public class Transaction extends BaseXml implements Serializable {
    public static final String NAME_SPACE_PREFIX = "<ns0:MT_POS_SALES_DATA xmlns:ns0=\"urn:cb:bhwsc:pos_sales_data_out\">";
    public static final String NAME_SPACE_SUFFIX = "</ns0:MT_POS_SALES_DATA>";

    @XStreamAlias("HEADER")
    private Header header;
    @XStreamAlias("ITEM1")
    private CustomerDetail customerDetail = new CustomerDetail();
    @XStreamImplicit
    private List<RetailItem> items;
    @XStreamImplicit
    private List<Discount> discounts;
    @XStreamImplicit
    private List<RetailItemExtension> retailItemExtensions;
    @XStreamImplicit
    private List<Loyalty> loyalties;
    @XStreamImplicit
    private List<Extension> extensions = Lists.newArrayList(new Extension());
    @XStreamImplicit
    private List<Payment> payments;

    public Header getHeader() {
        return header;
    }

    public void setHeader(Header header) {
        this.header = header;
    }

    public CustomerDetail getCustomerDetail() {
        return customerDetail;
    }

    public void setCustomerDetail(CustomerDetail customerDetail) {
        this.customerDetail = customerDetail;
    }

    public List<RetailItem> getItems() {
        return items;
    }

    public void setItems(List<RetailItem> items) {
        this.items = items;
    }

    public List<Discount> getDiscounts() {
        return discounts;
    }

    public void setDiscounts(List<Discount> discounts) {
        this.discounts = discounts;
    }

    public List<RetailItemExtension> getRetailItemExtensions() {
        return retailItemExtensions;
    }

    public void setRetailItemExtensions(List<RetailItemExtension> retailItemExtensions) {
        this.retailItemExtensions = retailItemExtensions;
    }

    public List<Loyalty> getLoyalties() {
        return loyalties;
    }

    public void setLoyalties(List<Loyalty> loyalties) {
        this.loyalties = loyalties;
    }

    public List<Extension> getExtensions() {
        return extensions;
    }

    public void setExtensions(List<Extension> extensions) {
        this.extensions = extensions;
    }

    public List<Payment> getPayments() {
        return payments;
    }

    public void setPayments(List<Payment> payments) {
        this.payments = payments;
    }

    public static void main(String[] args) {
        Transaction transaction = new Transaction();
        System.out.println(transaction.toXML());
    }
}
